import {
  createSelector,
  createFeatureSelector,
  ActionReducerMap
} from "@ngrx/store";
import * as fromUser from "./user.reducer";
import * as fromRoot from "@/reducers";
import { UserActions } from "../actions";

export interface UserState {
  user: fromUser.State;
}

export interface State {
  user: UserState;
}

export const reducers: ActionReducerMap<
  UserState,
  UserActions.UserActionsUnion
> = {
  user: fromUser.reducer
};

// export const getUserState = createFeatureSelector<State, UserState>("user");

// export const user = createSelector(
//   getUserState,
//   (state: any) => state.user.findUserResponse.data
// );

// export const hasAuth = createSelector(
//   getUserState,
//   (state: any) => state.user.findUserResponse.code === 200
// );

// export const userRes = createSelector(
//   getUserState,
//   (state: any) => state.user.findUserResponse
// );
